jq(function() {
	select1();
	function select1() {
		jq.getJSON("MemberProductLevelServlet", "opr=showlevel1", callBack)
		var select1 = jq("#select1").empty();
		function callBack(data) {
			for (var i = 0; i < data.length; i++) {
				select1.append("<option value=" + data[i].id + ">"
						+ data[i].name + "</option>")
			}
			function select2() {
				var id = jq("#select1").val();
				alert(id);

				var select2 = jq("#select2").empty();
				jq.getJSON("MemberProductLevelServlet", "opr=showlevel2&id="
						+ id, callBack)
				function callBack(data) {
					for (var i = 0; i < data.length; i++) {
						select2.append("<option value=" + data[i].id + ">"
								+ data[i].name + "</option>")
					}
					function select3() {
						var id = jq("#select2").val();
						alert(id);

						var select2 = jq("#select3").empty();
						jq.getJSON("MemberProductLevelServlet",
								"opr=showlevel3&id=" + id, callBack)
						function callBack(data) {
							for (var i = 0; i < data.length; i++) {
								select2.append("<option value=" + data[i].id
										+ ">" + data[i].name + "</option>")
							}
						}

					}
					select3();
				}

			}
			jq("#select1").change(function(){
				select2();
				
			})
			select2();
		}
	}
	
})